package com.ruibang.glass.produce.controller;

import com.ruibang.glass.produce.domain.req.ProduceOperateReq;
import com.ruibang.glass.produce.domain.resp.ProduceOperateResp;
import com.ruibang.glass.produce.entity.ProduceCost;
import com.ruibang.glass.produce.service.ProduceOperateService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: songJinKang
 * @CreateTime: 2024-04-08  16:18
 * @Description: TODO
 * @Version: 1.0
 */

@Api(value="生产经营数据控制器",tags={"生产经营数据控制器"})
@RestController
@RequestMapping("/api/product/operate")
public class ProduceOperateController {

    @Autowired
    private ProduceOperateService produceOperateService;

    @PostMapping("/getProduceOperate")
    @ApiOperation(value = "查询生产经营数据", response = ResultBody.class)
    public ResultBody<ProduceOperateResp> getProduceOperate(@RequestBody ProduceOperateReq operateReq) {
        return ResultBody.success(produceOperateService.getProduceOperate(operateReq));
    }

    @PostMapping("/addProduceCost")
    @ApiOperation(value = "新增生产费用", response = ResultBody.class)
    public ResultBody addProduceCost(@RequestBody ProduceCost produceCost) {
        produceOperateService.addProduceCost(produceCost);
        return ResultBody.success();
    }

    @PostMapping("/updateProduceCost")
    @ApiOperation(value = "更新生产费用", response = ResultBody.class)
    public ResultBody updateProduceCost(@RequestBody ProduceCost produceCost) {
        produceOperateService.updateProduceCost(produceCost);
        return ResultBody.success();
    }
}
